package routes

import (
	"toolsweb-admin/handlers"

	"github.com/gin-gonic/gin"
)

func RegisterSoftwareRoutes(router *gin.Engine) {
	softwareGroup := router.Group("/api/admin/software")
	{
		// 软件分类路由
		categoryGroup := softwareGroup.Group("/categories")
		{
			categoryGroup.GET("", handlers.ListSoftwareCategories)
			categoryGroup.POST("", handlers.CreateSoftwareCategory)
			categoryGroup.PUT("/:id", handlers.UpdateSoftwareCategory)
			categoryGroup.DELETE("/:id", handlers.DeleteSoftwareCategory)
		}

		// 软件条目路由
		itemGroup := softwareGroup.Group("/items")
		{
			itemGroup.GET("", handlers.ListSoftwareItems)
			itemGroup.POST("", handlers.CreateSoftwareItem)
			itemGroup.PUT("/:id", handlers.UpdateSoftwareItem)
			itemGroup.DELETE("/:id", handlers.DeleteSoftwareItem)
			itemGroup.GET("/category/:id", handlers.GetCategorySoftwareItems)
		}
	}
}
